package com.kly.user.serviceImpl;

import com.fqgj.common.api.Response;
import com.kly.user.db.dao.InterestDao;
import com.kly.user.db.entity.InterestEntity;
import com.kly.user.dto.InterestDto;
import com.kly.user.dto.chatter.Chatter;
import com.kly.user.service.InterestService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Service("interestService")
public class InterestServiceImpl implements InterestService {

    @Resource
    private InterestDao interestDao;

    @Override
    public Response<List<InterestDto>> getAll() {
        List<InterestDto> interestDtoList = new ArrayList<>();
        List<InterestEntity> interestEntities = interestDao.getAll();
        interestEntities.forEach(interest -> {
            InterestDto interestDto = new InterestDto();
            interestDto.setId(interest.getId());
            interestDto.setInterestName(interest.getInterestName());
            interestDtoList.add(interestDto);
        });
        return Response.ok(interestDtoList);
    }
}
